package com.tasly.attendance.domain.calc;

import com.tasly.attendance.domain.calc.impl.Eight2EightWorkingHoursCalculatorImpl;
import com.tasly.attendance.domain.calc.impl.NormalWorkingHoursCalculatorImpl;
import com.tasly.attendance.domain.calc.impl.NightlyWorkingHoursCalculatorImpl;
import com.tasly.attendance.domain.calc.impl.RestingWorkingHoursCalculatorImpl;

public class CalculateFactory {

    private CalculateFactory() {
        throw new Error("DO NOT use CalculateFactory as a instance!!");
    }
    
    //TODO: may need some refactor to make them configurable
    public static final int NORMAL_HOURS_CALCULATOR_TYPE = 1;
    public static final int EIGHT2EIGHT_HOURS_CALCULATOR_TYPE = 2;
    public static final int NIGHTLY_HOURS_CALCULATOR_TYPE = 3;
    public static final int RESTING_HOURS_CALCULATOR_TYPE = 4;
    
    public static Calculator getCalculator(int calculatorType) {
        Calculator calculator = null;
        switch (calculatorType) {
        case NORMAL_HOURS_CALCULATOR_TYPE:
            calculator = new NormalWorkingHoursCalculatorImpl();
            break;
        case EIGHT2EIGHT_HOURS_CALCULATOR_TYPE:
            calculator = new Eight2EightWorkingHoursCalculatorImpl();
            break;
        case NIGHTLY_HOURS_CALCULATOR_TYPE:
            calculator = new NightlyWorkingHoursCalculatorImpl();
            break;
        case RESTING_HOURS_CALCULATOR_TYPE:
            calculator = new RestingWorkingHoursCalculatorImpl();
            break;    
        default:
            calculator = new NormalWorkingHoursCalculatorImpl();
            break;
        }
        return calculator;
    }
}
